home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2004 July / APC0407D2.iso / workshop / onlineco / files / ImageMagick-6.0.1-Q16-windows-dll.exe / {app} / PerlMagick / demo / tree.pl < prev    next >
Encoding:
Perl Script  |  2003-12-29  |  675 b   |  30 lines

  1. #!/usr/bin/perl
  2. require "lsys.pl";
  3.  
  4. %rule = (
  5.       'A' => 'S[---LMA][++++B]',
  6.           'B' => 'S[++LBg][--Cg]',
  7.           'C' => 'S[-----LB]GS[+MC]',
  8.           'g' => '',
  9.           'L' => '[{S+S+S+S+S+S}]'
  10.         );
  11.  
  12. %stemchanges = (
  13.   distance => 18.5,
  14.   dtheta => 0.1,
  15.   motionsub => sub{
  16.                     $im->Draw ( primitive=>'line', points=>join(' ',@_),
  17.                                 stroke=>'dark green', strokewidth=>1 );
  18.                   }
  19. );
  20.  
  21. %polychanges = (
  22.   distance => 3,
  23.   dtheta => 0.4,
  24.   motionsub => sub{ push( @poly, @_[0..1] ); }
  25. );
  26.  
  27. $changes = \%stemchanges;
  28. lsys_init(400);
  29. lsys_execute('A', 10, "tree.gif", %rule);
  30.